home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / START.DOC < prev    next >
Text File  |  1988-02-10  |  8KB  |  157 lines

  1. Documentation for START.COM
  2.  
  3. Start runs any program or makes any DOS call at a specified time. If a user
  4. is operating the computer at that time, his process is suspended, everything
  5. including the screen is saved, and the commanded process begins. When the
  6. commanded process is through, everything is restored for the user (including
  7. the screen, cursor position, etc) and the user can resume where he/she was
  8. interrupted.
  9.  
  10. This program has some limitations since the IBM PC/AT/XT is not a multi task-
  11. ing system. The most obvious limitation is that the user gets interrupted!
  12. The second is that the program being invoked by START can't use all the system
  13. memory. It can only use about 62k. If it attempts to use more, the system will
  14. crash as explained later on.
  15.  
  16. START.COM gives up all the memory that it "acquired" when it exits so it is
  17. possible to "chain" several START(s). For instance, START could invoke a batch
  18. program who's last line evoked START again.
  19.  
  20. Usage:
  21. START [hh:mm:ss] [doscommand]
  22. Where: [hh:mm:ss] is the time in 00:00:00 format (no brackets).
  23.        [doscommand] is any command (up to 64 characters in length).
  24.  
  25. Note: A path must exist for the [doscommand]. For instance, the interrupt
  26. could occur when the user is in any directory or subdirectory. If you wish to
  27. run BACKUP.EXE at 1600 hours, and BACKUP.EXE is in the top directory, you must
  28. invoke START with the following command line.
  29.  
  30. START 16:00:00 \BACKUP
  31.  
  32. Limitations:
  33. There are NO defaults, and all fields in the [hh:mm:ss] portion must be
  34. filled (8 O'clock is 08:00:00).
  35.  
  36. 24:00:00 does NOT exist! It is 00:00:00.
  37.  
  38. A copy of COMMAND.COM (with the correct dos version) must exist in the top
  39. directory of the default drive.
  40.  
  41. The program to be run must not attempt to use more than 64k! If is does,
  42. the system WILL crash! This is because when START.COM is envoked, it acquires
  43. 64k from the system. When it runs the program, it relinquishes all except the
  44. bare minimum that it requires to exist. It does this so there is room for
  45. COMMAND.COM and the called program to be loaded. COMMAND.COM is detached from
  46. the rest of the system and doesn't "know" that memory blocks after START.COM
  47. are probably in use by the program that just got interrupted. It will load
  48. the program overlay just after itself. If the program is not too big, there
  49. will be room and everything will be fine. If there is not enough room, the
  50. system will crash when returning to the interrupted program. This could, of
  51. course, be prevented by having START.COM acquire 128k from the system when
  52. it's loaded. Some systems don't have 128k to give up (and still be able to
  53. run another program)! A compomise.
  54.  
  55. A full understanding of this program and how it works will prevent user's
  56. from having any problems.
  57.  
  58. How it works:
  59.  
  60. When START.COM is first loaded it "owns" all the memory in the computer
  61. just like any other .COM program. In order for you to run other programs
  62. after START.COM issues a terminate, but stay resident call to MS-DOS, it
  63. must give up some memory. It does this by keeping 64k and relinquishing the
  64. rest.
  65.  
  66. START.COM parses the input command string and puts the saved time and the
  67. program to be run in a memory area safe from harm. It also redirects two
  68. interrupt vectors from the system clock. Every "TICK" of the system clock,
  69. which occurs about 18.5 times per second causes a counter to be decremented
  70. so that the system clock is "divided" by 18.5 to produce one-second ticks.
  71.  
  72. A local "clock" within START.COM (which was set only once when START.COM was
  73. loaded) is incremented at each second, minute, hour, etc. Every time the
  74. seconds count is changed, START.COM checks to see if the internal time
  75. is the same as the commanded time when it was loaded. When the two times
  76. are equal, a lot of very important things are caused to happen.
  77.  
  78. 1./ A flag is set to tell START.COM that the time is up.
  79.  
  80. 2./ A "critical DOS" flag is checked to see if it is safe to interrupt
  81.     MS-DOS. If not, the program continues (returns to the interrupted task).
  82.     When is is safe to do so, the following things occur.
  83.  
  84. 3./ The user's FLAGS, STACK, and REGISTERS are saved (on a private stack).
  85.  
  86. 4./ The user's entire screen contents are saved (16k...all possible pages
  87.     of screen memory). Also the cursor position, type, and background colors.
  88.     This is saved in a temporary file called SCREEN.TMP. Unless the system
  89.     crashes you probably will never see this file since it is deleted when
  90.     the process exits. This file resides in the top directory of the default
  91.     disk.
  92.  
  93. 5./ The user's data transfer area (DTA) is saved (in memory).
  94.  
  95. 6./ The user's directory and current disk is saved (in memory).
  96.  
  97. 7./ It is not possible to save the user's type-ahead buffer.
  98.  
  99. 8./ START.COM gives back to the system all but 2k of memory. This is to make
  100.     room for COMMAND.COM and the program(s) it might load and execute.
  101.  
  102. 9./ COMMAND.COM is loaded and executes the command string supplied when
  103.     START.COM was loaded. This could be .COM .BAT or .EXE files. Also
  104.     system calls.
  105.  
  106. 10./ When COMMAND.COM is through, or when a control_C or control_Brk is
  107.      entered, it returns to START.COM.
  108.  
  109. 11./ START.COM restores the user's current disk, directory, screen contents,
  110.      cursor type, cursor position, data transfer area. It also deletes the
  111.      temporary work file SCREEN.TMP
  112.  
  113. 12./ START.COM restores the interrupt vectors to where they pointed before
  114.      START.COM was ever loaded.
  115.  
  116. 13./ START.COM gives back to the system ALL memory that it acquired.
  117.      (commits suicide).
  118.  
  119. 14./ START.COM restores all the user's registers, stack, and flags.
  120.  
  121. 15./ In it's last moments of existance, START.COM issues an interrupt
  122.      return call and the user's program continues from where is was
  123.      interrupted.
  124.  
  125. Since, after the completion of START.COM's duties, it no longer exists,
  126. there is no limitation to the number ot times that is can be invoked except
  127. the available memory when all processes are loaded. Each time START.COM
  128. completes, it gives back 64k of memory to the system pool. 
  129.  
  130. As mentioned START.COM keeps it's own time in it's own private clock. This
  131. is to reduce the amount of CPU time that is uses from the system when it
  132. is resident. START.COM's clock get's set to the system clock ONLY when it
  133. is first loaded. If you reset the system clock, it will have NO effect upon
  134. the time that START.COM is using! START.COM divides the system "tick" by
  135. 18.2 to make one-second ticks. It really should divide it by 18.208! This
  136. means that the clock will be off about 1 second in 24 hours.
  137.  
  138. All input during START.COM's program overlay should come from a FILE (like
  139. a batch file, etc.) No input should come from the system console except
  140. control_C or control_brk. This is to preserve the user's type-ahead buffer
  141. which could be ANYWHERE (and therefore can't be saved and restored).
  142.  
  143. Another limitation (which I am trying to fix for a future version) is that
  144. one can't make DOS calls when DOS is is command! This is the purpose of
  145. the "critical DOS flag". This is because DOS does not save everything on
  146. a stack, but in certain memory locations (unknown ...since DOS could be
  147. loaded anywhere). If a program should make a DOS call from DOS, the original
  148. return addresses will be lost and replaced with the new ones....a crash will
  149. follow. Therefore...if you are sitting on the C> prompt when the time is
  150. up, nothing will happen! Of course, as soon as you load a program or do a
  151. directory or anything like that, START.COM will take over and do it's duty.
  152.  
  153. A future version will save EVERYTHING in DOS and restore upon completion
  154. so that it can ignore the critical DOS flag.
  155.  
  156. RBJ
  157.